/* GUI CONVERTED from rcrbrp02.p (converter v1.76) Fri May  3 13:21:30 2002 */
/* rcrbrp02.p - Release Management Customer Schedules                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10.1.5 $                                                      */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 7.3    LAST MODIFIED: 11/09/92           BY: WUG *G462*          */
/* REVISION: 7.4    LAST MODIFIED: 09/13/93           BY: WUG *H109*          */
/* REVISION: 7.4    LAST MODIFIED: 05/04/94           BY: WUG *H363*          */
/* REVISION: 7.3    LAST MODIFIED: 10/18/94           BY: jzs *GN91*          */
/* REVISION: 8.5    LAST MODIFIED: 05/31/95           BY: tjs *J04Y*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 08/28/00   BY: *N0NZ* Dave Caveney       */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.10.1.4     BY: Jean Miller       DATE: 03/22/01  ECO: *P008*   */
/* $Revision: 1.10.1.5 $    BY: Katie Hilbert     DATE: 04/15/02  ECO: *P03J*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

/* RETROBILL INVOICE HISTORY REPORT */

define new shared variable addr as character format "x(38)" extent 6.

define variable soldto_from   like so_cust no-undo.
define variable soldto_to     like so_cust no-undo.
define variable shipfrom_from like scx_shipfrom no-undo.
define variable shipfrom_to   like scx_shipfrom no-undo.
define variable cust_from     like so_cust no-undo.
define variable cust_to       like so_cust no-undo.
define variable shipto_from   like so_ship no-undo.
define variable shipto_to     like so_ship no-undo.
define variable part_from     like sod_part no-undo.
define variable part_to       like sod_part no-undo.
define variable po_from       like sod_contr_id no-undo.
define variable po_to         like sod_contr_id no-undo.
define variable order_from    like so_nbr no-undo.
define variable order_to      like so_nbr label {t001.i} no-undo.
define variable line_from     like sod_line format ">>>9" no-undo.
define variable line_to       like sod_line format ">>>9" label {t001.i} no-undo.
define variable inv_from      like ih_inv_nbr no-undo.
define variable inv_to        like ih_inv_nbr label {t001.i} no-undo.
define variable rsn_cmmt      like code_cmmt no-undo.
define variable rbmcust       like rbm_cust no-undo.
define variable rbmauth       like rbm_auth no-undo.
define variable custref_to    like scx_custref label {t001.i} no-undo.
define variable custref_from  like scx_custref no-undo.
define variable modelyr_to    like scx_modelyr label {t001.i} no-undo.
define variable modelyr_from  like scx_modelyr no-undo.

define variable billto        as character format "x(38)" extent 6 no-undo.
define variable shipto        as character format "x(38)" extent 6 no-undo.
define variable cust          like so_cust no-undo.
define variable ship          like so_ship no-undo.
define variable i             as integer no-undo.
define variable last_auth     like rbm_auth     column-label "Previous!Amendment Number" no-undo.
define variable last_price    like idh_price           label "Previous Price" no-undo.
define variable adj_amt       like idh_price    column-label "Price Change"
                              format "->,>>>,>>9.99<<<" no-undo.
define variable adj_amt_ext   like idh_price    column-label "Extended!Price Change"
                              format "->>,>>>,>>9.99" no-undo.
define variable new_price     like rbm_newprice column-label "Amended Price" no-undo.
define variable rbd_price_change like mfc_logical  column-label "P!C"
                                 format "P/C" no-undo.




/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
shipfrom_from        colon 14 label "Ship-From"
   shipfrom_to          colon 45 label {t001.i}
   soldto_from          colon 14
   soldto_to            colon 45 label {t001.i}
   shipto_from          colon 14
   shipto_to            colon 45 label {t001.i}
   part_from            colon 14
   part_to              colon 45 label {t001.i}
   po_from              colon 14 format "x(22)"
   po_to                colon 45 label {t001.i} format "x(22)"
   custref_from         colon 14 format "x(26)"
   custref_to           colon 45 format "x(26)"
   modelyr_from         colon 14
   modelyr_to           colon 45
   order_from           colon 14
   order_to             colon 45
   inv_from             colon 14
   inv_to               colon 45
   line_from            colon 14
   line_to              colon 45
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).


/*GUI mainloop removed */


/*GUI*/ {mfguirpa.i false "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if shipfrom_to = hi_char then shipfrom_to = "".
   if soldto_to   = hi_char then soldto_to   = "".
   if shipto_to   = hi_char then shipto_to   = "".
   if part_to     = hi_char then part_to     = "".
   if po_to       = hi_char then po_to       = "".
   if order_to    = hi_char then order_to    = "".
   if inv_to      = hi_char then inv_to      = "".
   if line_to     = 999999  then line_to     = 0.
   if custref_to  = hi_char then custref_to  = "".
   if modelyr_to  = hi_char then modelyr_to  = "".

   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   if shipfrom_to = "" then shipfrom_to = hi_char.
   if soldto_to   = "" then soldto_to   = hi_char.
   if shipto_to   = "" then shipto_to   = hi_char.
   if part_to     = "" then part_to     = hi_char.
   if po_to       = "" then po_to       = hi_char.
   if order_to    = "" then order_to    = hi_char.
   if inv_to      = "" then inv_to      = hi_char.
   if line_to     = 0  then line_to     = 999999.
   if custref_to  = "" then custref_to  = hi_char.
   if modelyr_to  = "" then modelyr_to  = hi_char.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:

define buffer rbmmstr for rbm_mstr.



   {mfphead.i}

   FORM /*GUI*/  header
      skip(1)
   with STREAM-IO /*GUI*/  frame heading page-top.

   view frame heading.

   for each ih_hist no-lock
      where ih_cust >= soldto_from and ih_cust <= soldto_to
        and ih_nbr >= order_from and ih_nbr <= order_to
        and ih_ship >= shipto_from and ih_ship <= shipto_to
        and ih_inv_nbr >= inv_from and ih_inv_nbr <= inv_to
   use-index ih_cust,
      each idh_hist no-lock
     where idh_inv_nbr = ih_inv_nbr
       and idh_nbr = ih_nbr
       and idh_site >= shipfrom_from and idh_site <= shipfrom_to
       and idh_part >= part_from and idh_part <= part_to
       and idh_contr_id >= po_from and idh_contr_id <= po_to
       and idh_hist.idh_custref >= custref_from
       and idh_hist.idh_custref <= custref_to
       and idh_modelyr >= modelyr_from and idh_modelyr <= modelyr_to
       and idh_line >= line_from and idh_line <= line_to,
         each qad_wkfl no-lock
        where qad_key3 = "rbd_det"
          and qad_key4 = string(idh_nbr,"x(8)") +
                         string(integer(idh_line),"99999")
          and qad_datefld[1] <= ih_ship_date
          and qad_datefld[2] >= ih_ship_date,
            each rbm_mstr no-lock
           where rbm_cust = qad_charfld[7]
            and rbm_auth = qad_charfld[8]
   break by ih_cust by ih_inv_nbr by ih_nbr by idh_line by rbm_eff by rbm_auth
         by idh_hist.idh_custref by idh_hist.idh_modelyr
   with width 132 no-box frame ih:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame ih:handle).
      if first-of(idh_line) then do:
         display
            ih_cust
            ih_inv_nbr
            ih_nbr
            idh_line format ">>>9" WITH STREAM-IO /*GUI*/ .

         last_price = idh_price.
      end.

      rsn_cmmt = "".
      find code_mstr where code_fldname = "rbm_rsn" and code_value = rbm_rsn
      no-lock no-error.
      if available code_mstr then
         rsn_cmmt = code_cmmt.

      if qad_charfld[9] = "y" then
         new_price = qad_decfld[1].
      else
         new_price = last_price + qad_decfld[1].

      assign
         adj_amt = new_price - last_price
         adj_amt_ext = adj_amt * idh_qty_inv
         last_price = new_price
         rbd_price_change = qad_charfld[9] = "y".

      display
         rbm_auth         column-label "Amendment Number"
         rbm_eff          column-label "As-of!Date"
         rbm_rsn
         rbd_price_change
         new_price        format "->>>,>>>,>>9.99<<<"
         adj_amt
         idh_qty_inv
         idh_um
         adj_amt_ext WITH STREAM-IO /*GUI*/ .

      if rbm_cmtindx > 0 then do:
         {gpcmtprt.i &type=RP &id=rbm_cmtindx &pos=32 &command="down 1."}
      end.

      if last-of(idh_line) then
         down 1.

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end.

   hide frame heading.

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" shipfrom_from shipfrom_to soldto_from soldto_to shipto_from shipto_to part_from part_to po_from po_to custref_from custref_to modelyr_from modelyr_to order_from order_to inv_from inv_to line_from line_to "} /*Drive the Report*/
